package com.breaker.kata.leetcode;

public class PalindromeNumber {

    public boolean isPalindrome(int x) {
        if (x < 0 || (x % 10 == 0 && x != 0)) {
            return false;
        }
        int reversalNum = 0;
        while (x > reversalNum) {
            reversalNum = ((reversalNum << 3) + (reversalNum << 1)) + x % 10;
            x /= 10;
        }
        return x == reversalNum || x == reversalNum / 10;
    }
}
